home *** CD-ROM | disk | FTP | other *** search
/ More SimCities / More SimCities (1997).iso / sc / tools / simtools / simcity.h < prev    next >
C/C++ Source or Header  |  1997-06-17  |  2KB  |  95 lines

  1. /* Simcity city file structure -- Based on SIMFOR.TXT
  2.  * Coded and uploaded by Ed Greenberg 76703,1070
  3.  * Corrections welcome
  4.  *
  5.  * Note that the numbers that appear in the file are in high-low order,
  6.  * backwards from the conventions of the iNTEL 80x86 family.  They must be
  7.  * reversed to be manipulated by C or assembler on the PC.  Code to do this
  8.  * is shown at the bottom of the file.
  9.  *
  10.  * Remember that this assumes that ints are 2 bytes and longs are 4.  Unix
  11.  * people will need to make adjustments.  Since these are all even length
  12.  * datatypes, no pragma pack's are needed.
  13.  */
  14.  
  15. struct _cityfile
  16. {
  17.     char name[128];
  18.     char ResHis[480];
  19.     char ComHis[480];
  20.     char IndHis[480];
  21.     char CrimeHis[480];
  22.     char PolluteHis[480];
  23.     char CashFlowHis[480];
  24.     struct _vars
  25.     {
  26.         unsigned int filler;
  27.         unsigned int ExtMkt;
  28.         unsigned int ResPop;    /* doesn't make sense */
  29.         unsigned int ComPop;    /* doesn't make sense */
  30.         unsigned int IndPop;    /* doesn't make sense */
  31.         unsigned int ResValve;
  32.         unsigned int ComValve;
  33.         unsigned int IndValve;
  34.         unsigned long CityTime; /* divide by 48 and add 1900 */
  35.         unsigned int CrimeRamp;
  36.         unsigned int PolluteRamp;
  37.         unsigned int LandValueAvg;
  38.         unsigned int CrimeAvg;
  39.         unsigned int PolluteAvg;
  40.         unsigned int GameLevel;
  41.         unsigned int CityClass;
  42.         unsigned int CityScore;
  43.         unsigned int filler1[32];
  44.         unsigned long TotalFunds;
  45.         unsigned int AutoBulldoze;
  46.         unsigned int AutoBudget;
  47.         unsigned int AutoGoto;
  48.         unsigned int Sound;
  49.         unsigned int TaxRate;
  50.         unsigned int SimSpeed;
  51.         unsigned long PoliceBud;
  52.         unsigned long FireBud;
  53.         unsigned long RoadBud;
  54.         unsigned int filler2[56];
  55.     } vars;
  56.     unsigned int map[120][100]; /* 120 columns by 100 rows */
  57. } cityfile;
  58.  
  59.  
  60. /* code to reverse ints and longs
  61.  
  62. THIS CODE IS COMMENTED OUT.  CUT IT OUT AND PASTE IT INTO YOUR OWN PROGRAM
  63.  
  64. int swapint(i)
  65. int i;
  66. {
  67.     int t;
  68.     t=i & 0xff;
  69.     i >>= 8 ;
  70.     i &= 0xff;
  71.     i |= (t << 8);
  72.     return i;
  73. }
  74.  
  75. long swaplong(l)
  76. long l;
  77. {
  78.     long t,ll;
  79.     int i;
  80.  
  81.     t = 0L;
  82.     ll = l;
  83.     for(i=0;i<4;i++)
  84.     {
  85.         t<<=8;
  86.         t |= (ll & 0xff);
  87.         ll>>=8;
  88.     }
  89.  
  90.     return t;
  91. }
  92.  
  93.  
  94. */
  95.